<script setup>
import { watch } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import { useDataStore } from '@/stores/user.js'

const user = useDataStore()
const route = useRoute()
const router = useRouter()

watch(route, (newVal, oldVal) => {
  // console.log(user.userData.token)
  // console.log(route.meta.bc)
  if (!user.userData.token && newVal.path !== '/login') {
    router.push({ path: '/login' })
  }
})
</script>

<template>
  <RouterView />
</template>

<style scoped lang="scss"></style>
